﻿<UserControl x:Class="Sovacode.DemoApp.View.BehaviorView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
             xmlns:behavior="clr-namespace:Sovacode.RubiksCube.Common.View;assembly=Sovacode.RubiksCube.Common"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="250"></ColumnDefinition>
            <ColumnDefinition Width="*"></ColumnDefinition>
        </Grid.ColumnDefinitions>

        <TreeView Grid.Row="1" ItemsSource="{Binding DataObjects}" ItemTemplate="{StaticResource SimpleData}" Height="250" Margin="5,5,0,5">
            <i:Interaction.Behaviors>
                <behavior:TreeViewSelectedItemBehavior SelectedItem="{Binding Path=SelectedDataObject, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
            </i:Interaction.Behaviors>
        </TreeView>

        <StackPanel Grid.Column="1" Orientation="Vertical">
            <TextBlock Text="Selected in TreeView Data Object Name:" Margin="10,5,10,0"/>
            <TextBox Text="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" IsReadOnly="True" Margin="10,5,10,0" Height="23" VerticalContentAlignment="Center"/>
        </StackPanel>

    </Grid>
</UserControl>
